package com.tristia.entity.util;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import com.tristia.dao.GenericDao;
import com.tristia.entity.Review;

public class ReviewDataLoader {
	private List<Review> reviews = new ArrayList<Review>();
	@Resource
	GenericDao<Review, Long> reviewDao;
	
	public void loadData() {
		for (Review review : reviews) {
			reviewDao.save(review);
		}
		reviews.clear();
		reviews = null;
	}

	public void setReviews(List<Review> reviews) {
		this.reviews = reviews;
	}
	
	public void init() {
		loadData();
	}
}
